package org.komarichin.struts2.beans.models;

/**
 * User: Michael Komarichin
 * Date: 06.10.2009
 * Time: 16:26:14
 */
public class UserRoleModel {
    private Long id;
    private String login;
    private String roleName;
    private Long rolePermission;

    public UserRoleModel(Long id, String login, String roleName, Long rolePermission) {
        this.id = id;
        this.login = login;
        this.roleName = roleName;
        this.rolePermission = rolePermission;
    }

    public UserRoleModel() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public Long getRolePermission() {
        return rolePermission;
    }

    public void setRolePermission(Long rolePermission) {
        this.rolePermission = rolePermission;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("UserRoleModel");
        sb.append("{id=").append(id);
        sb.append(", login='").append(login).append('\'');
        sb.append(", roleName='").append(roleName).append('\'');
        sb.append(", rolePermission=").append(rolePermission);
        sb.append('}');
        return sb.toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof UserRoleModel)) return false;

        UserRoleModel that = (UserRoleModel) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (login != null ? !login.equals(that.login) : that.login != null) return false;
        if (roleName != null ? !roleName.equals(that.roleName) : that.roleName != null) return false;
        if (rolePermission != null ? !rolePermission.equals(that.rolePermission) : that.rolePermission != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (login != null ? login.hashCode() : 0);
        result = 31 * result + (roleName != null ? roleName.hashCode() : 0);
        result = 31 * result + (rolePermission != null ? rolePermission.hashCode() : 0);
        return result;
    }
}
